/**
 * 通话记录
 * @authors supmain (mtingfeng@gmail.com)
 * @date    2015-02-03 14:28:55
 * @for call_log.html
 */
var BSTYUN = BSTYUN || {};
BSTYUN.callog = {
	init: function(){
		var that = this;
		that.softRecord();
	},
	softRecord: function(){
		var $telrecord = $("#telrecord"),
			$startime = $("#startime"),
			$endtime = $("#endtime"),
			$recordtable = $("#recordtable");
		/* 时间过滤 */
		$telrecord.on("keydown","#startime,#endtime",function(){
			return false;
		}).on("click",".confirm",function(){
			var startime = $.trim( $startime.val() ),
				endtime = $.trim( $endtime.val() );
			var stime = (new Date( startime.replace(/-/gi,"/") )).getTime() ,
				etime = (new Date( endtime.replace(/-/gi,"/") )).getTime() ;
			if( stime > etime ){
				BSTYUN.dialog.warn("起始时间不能大于结束时间！");
				return false;
			};
			goSoftResult( { startime: startime , endtime: endtime } );
		});
		function goSoftResult( data ){
			$.ajax({
				url: '/path/to/file',
				type: 'post',
				dataType: 'json',
				data: data,
				beforeSend: null,
				complete: null,
				success: function( data ){
					var html = "";
					// 遍历数据
					//$recordtable.html( html );
				},
				error: function(){
					BSTYUN.dialog.warn("网络异常！");
				}
			});
		};
	}
};
$(function(){
	BSTYUN.callog.init();
});